import {createSlice} from "@reduxjs/toolkit";

const countSlice = createSlice({
    name: 'count',
    initialState: {
        count: 0,
        message: 'hello world',
    },
    reducers: {
        addNumberAction(state, action) {
            state.count += action.payload
        },
        subNumberAction(state, {payload}) {
            state.count -= payload
        },
        changeMessageAction(state, {payload}) {
            state.message = payload
        }
    }
})

export const {addNumberAction, subNumberAction, changeMessageAction} = countSlice.actions;
export default countSlice.reducer;